// components/headers/headers.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    title:{
      type:String,
      value: ""
    },
    type:{
      type:String,
      value:""
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    sjheight:wx.getMenuButtonBoundingClientRect().top,
    jnheight:wx.getMenuButtonBoundingClientRect().height
  },
  onLoad(){
  },
  onShow(){
    let pillHeight = wx.getMenuButtonBoundingClientRect().top  // 胶囊到顶部的高度
    let pill = wx.getMenuButtonBoundingClientRect().height  // 胶囊的高度
    this.setData({sjheight:pillHeight})
  },
  created(){
    let pillHeight = wx.getMenuButtonBoundingClientRect().top  // 胶囊到顶部的高度
    let pill = wx.getMenuButtonBoundingClientRect().height  // 胶囊的高度
    this.setData({sjheight:pillHeight})
  },
  /**
   * 组件的方法列表
   */
  methods: {
    black() {
      console.log(this.data.type,'type');

      if(this.data.type == 1)
      {
        wx.navigateBack(-1)
      }else if(this.data.type == 2)
      {
        wx.switchTab({
          url: '/pages/my/my',
        })
      }else if(this.data.type == 3)
      {
        wx.switchTab({
          url: '/pages/merchanthome/merchanthome',
        })
      }else if(this.data.type == 4)
      {
        wx.navigateBack(-1)
      }else if (this.data.type == 6)
      {
        console.log(this.data.type,'type');
        wx.switchTab({
          url: '/pages/merchant/merchant',
        })
      }else if (this.data.type == 8)
      {
        wx.switchTab({
          url: '/pages/merchanthome/merchanthome',
        })
      }
    },
  }
})